<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>宿舍管理</title>
	<jsp:include page="../common/common.jsp"></jsp:include>
	<style>
		
		#quitlogin{
			width: 80px;
			height: 20px;
			float: right;
		}

	</style>
	</head>
	<body>
		欢迎：<span id="loginMan">${sessionScope.username}</span>
			
		<input id="quitlogin" type="button" value="退出登录" />
		
		<div align="center" >
			<h4>欢迎使用宿舍管理系统...</h4>
		</div>
	<script type="text/javascript">
		
		
		$(function(){
			var username= $('#loginMan').text();
			if(username==""){
				window.location.href="${pageContext.request.contextPath}/login/login.jsp";
			}
			
			$('#quitlogin').click(function(){
				$.ajax({
					'type':'post',
					'dateType':'json',
					'url':'${pageContext.request.contextPath}/admin/quitlogin',
					'success':function(msg){
						if(msg.code==200){
							
							$.messager.show({
								title:'退出成功',
								msg:'消息将在1秒后关闭。',
								timeout:1000,
								showType:'slide'
							});
							window.location.href="${pageContext.request.contextPath}/login/login.jsp";
						}
					},
				});	
			});
		});
		
	</script>
</body>
	
</html>